package com.niu.controller;

import com.niu.dto.EmpLoginDto;
import com.niu.pojo.MyResult;
import com.niu.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 鹅鹅鹅
 * @Version 1.0.0
 * @Date 2025/7/17 15:17
 * @Description 员工登录表述层
 */
@RestController
@RequestMapping("/login")
public class EmpLoginController {

    @Autowired
    private EmpService empService;

    @PostMapping
    public MyResult<String> login(@RequestBody EmpLoginDto dto){
        // 如果登录成功, 业务层返回jwt令牌, 登录失败返回null
        return empService.login(dto);
    }

}
